package lock;

import java.util.Random;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Writer {
	private ReentrantLock mLock = new ReentrantLock();
	private Random mRandom = new Random();
	public void print(){
		System.out.println(mLock.getHoldCount()+"--------------------------");
		System.out.println(mLock.isHeldByCurrentThread()+"hold if");
		mLock.lock();
		System.out.println(mLock.hasQueuedThreads()+"ques");
		int time = mRandom.nextInt(100);
		System.out.println("sleep"+time);
		mLock.unlock();
	}
	

}
